package cn.com.fuhuitong.main.mine.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import cn.com.fuhuitong.app.BaseApplication
import cn.com.fuhuitong.base.BaseViewModel
import cn.com.fuhuitong.http.BaseResponse
import cn.com.fuhuitong.http.HttpResponse
import cn.com.fuhuitong.http.ViewModelSubscribeListener
import cn.com.fuhuitong.main.home.entity.CharityListResponse
import cn.com.fuhuitong.main.home.entity.HomeResponse
import cn.com.fuhuitong.main.mine.entity.*
import cn.com.fuhuitong.main.mine.mode.MineManager
import cn.com.fuhuitong.main.order.mode.OrderManager
import io.reactivex.disposables.Disposable

class IncomeViewModel(application: Application) : BaseViewModel(application) {

    private val mineManager: MineManager = MineManager()

    val mineIncomeCenterDataLiveData = MutableLiveData<HttpResponse<MineIncomeCenterResponse>>()

    val mineIncomeListDataLiveData = MutableLiveData<HttpResponse<MineIncomeListResponse>>()


    /**
     * 收益中心
     */
    fun orderStoreCommission() {
        val distributionCenterDisposable: Disposable = mineManager.orderStoreCommission(
            BaseApplication.userToken(), ViewModelSubscribeListener(mineIncomeCenterDataLiveData)
        )
        dispose.add(distributionCenterDisposable)
    }

    /**
     * 收益列表
     */
    fun orderStoreOrder() {
        val distributionCenterDisposable: Disposable = mineManager.orderStoreOrder(
            BaseApplication.userToken(),
            "1", "200",
            ViewModelSubscribeListener(mineIncomeListDataLiveData)
        )
        dispose.add(distributionCenterDisposable)
    }


}